package all_router

import (
	"github.com/gin-gonic/gin"
	"shangyuapi/controller/admin"
	"shangyuapi/controller/hongniang"
	"shangyuapi/controller/user"
)

// 总路由
func InitRouter(router *gin.Engine) {
	// 创建一个新的 RateLimiter 实例，每秒允许5个请求，突发数为5
	rl := NewRateLimiter(5, 5)
	admin_group := router.Group("/admin")
	user_group := router.Group("/user", HelloMiddleware(rl))
	hongniang_group := router.Group("/hongniang")
	admin.Router(admin_group)
	user.Router(user_group)
	hongniang.Router(hongniang_group)
}
